﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EasyProjects.ClientModel.Entities;
using EasyProjects.Client;

namespace EasyProjects.TimeLogger
{
    public static class ActivityExtender
    {
        #region ProjectStatus
        private static List<TaskStatus> _activityStatuses;

       
        private static List<TaskStatus> ActivityStatuses
        {
            get
            {
                if (_activityStatuses == null)
                    _activityStatuses = ObjectsHelper.Instance.Client.Query<TaskStatus>().ToList();

                return _activityStatuses;
            }
        }

        /// <summary>
        /// Statuses the specified TSK.
        /// </summary>
        /// <param name="tsk">The TSK.</param>
        /// <returns></returns>
        public static TaskStatus Status(this Task tsk)
        {
            return ActivityStatuses.Single(p => p.TaskStatusID == tsk.TaskStatusID);
        }
        #endregion
    }
}
